{% extends "layout.html" %}
{% load static %}
{% block css %}

{% endblock %}
{% block content %}
<!-- 工具栏 -->
<div class="layui-form layui-row layui-col-space10">
    <div class="layui-col-md1">
        <a href="/admin/add/" class="layui-btn layui-btn-sm"><i class="layui-icon">&#xe654;</i>新增管理员</a>
    </div>
    <div class="layui-col-md3 layui-col-md-offset6">
        <form method="get" action="" autocomplete="off">
            <div class="layui-input-group">
                <input name="search" value="{{search_value|default:''}}" type="text"
                       placeholder="模糊搜索" class="layui-input" lay-affix="clear" autocomplete="off">
                <div class="layui-input-suffix">
                    <button type="submit" class="layui-btn layui-btn-primary">
                        <i class="layui-icon layui-icon-search"></i>
                    </button>
                </div>
            </div>
        </form>
    </div>
</div>
<!-- 数据表格 -->
<table class="layui-table">
    <!-- 表格内容 S-->
    <table class="layui-table">
        <colgroup>
            <col width="100">
            <col>
            <col>
        </colgroup>
        <thead>
        <tr>
            <th>ID</th>
            <th>用户名</th>
            <th>密码</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        {% for item in data_list %}
        <tr>
            <td>{{item.id}}</td>
            <td>{{item.username}}</td>
            <td>{{item.password}}</td>
            <td>
                <a href="/admin/{{item.id}}/reset/" class="layui-btn layui-btn-sm">重置密码</a>
                <a href="/admin/{{item.id}}/edit/" class="layui-btn layui-btn-sm">编辑</a>
                <a href="/admin/delete/?id={{item.id}}" class="layui-btn layui-btn-sm layui-btn-danger">删除</a>
            </td>
        </tr>
        {% endfor %}
        </tbody>
    </table>
</table>
<!-- 分页区域 -->
<div id="LayPageComps"></div>
{% endblock %}

{% block js %}
<script src="{% static 'js/pagination.js' %}"></script>
<script>
    document.addEventListener('DOMContentLoaded', function() {
        initPagination('LayPageComps', {{totals}}, {{current_page}}, {{page_size}});
    });
</script>
{% endblock %}

